package com.ChenYaRou.www.dao;

import com.ChenYaRou.www.po.Message;

import java.sql.SQLException;
import java.util.List;

/**
 * @author 86183
 */
public interface MessageDao {
    /**
     * 新建留言
     * @param message 新留言
     * @return 更新条数
     * @throws IllegalAccessException
     * @throws SQLException
     */
    int insert(Message message) throws IllegalAccessException, SQLException ;


    /**
     * update message state
     * @param newMessage message更新的值
     * @param  oldMessage old message
     * @return 成功与否
     * @throws IllegalAccessException
     * @throws SQLException
     */
    int update(Message newMessage,Message oldMessage) throws IllegalAccessException, SQLException;

    /**
     * 删除留言
     * @param  messageId 留言的id
     * @return 成功与否
     * @throws  SQLException
     */
    int delete(int messageId) throws SQLException;

    /**
     * 查找message集合
     * @param message 条件message
     * @return
     * @throws IllegalAccessException
     * @throws SQLException
     * @throws NoSuchFieldException
     * @throws InstantiationException
     */
    List<Message> selectMore(Message message) throws IllegalAccessException,
            SQLException, NoSuchFieldException, InstantiationException ;
}
